import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AccountInfoVO, AccountInfoForm, AccountInfoQuery } from '@/api/system/accountInfo/types';

/**
 * 查询账号信息列表
 * @param query
 * @returns {*}
 */

export const listAccountInfo = (query?: AccountInfoQuery): AxiosPromise<AccountInfoVO[]> => {
  return request({
    url: '/system/accountInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询账号信息详细
 * @param id
 */
export const getAccountInfo = (id: string | number): AxiosPromise<AccountInfoVO> => {
  return request({
    url: '/system/accountInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增账号信息
 * @param data
 */
export const addAccountInfo = (data: AccountInfoForm) => {
  return request({
    url: '/system/accountInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改账号信息
 * @param data
 */
export const updateAccountInfo = (data: AccountInfoForm) => {
  return request({
    url: '/system/accountInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除账号信息
 * @param id
 */
export const delAccountInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/accountInfo/' + id,
    method: 'delete'
  });
};
